/**
 * 
 */
package junit4.test;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;

import junit.framework.JUnit4TestAdapter;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author Jordan Barroga, 
 * 		   Nina Shao, 
 * 		   Satoshi Morimoto
 */
public class ICScreationTest {
	//private ICScreation testNULL;
	//private ICScreation fileName;
	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		//Code executed before the first test method
		System.out.println("setUpBeforeClass");
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		//Code executed after the last test method
		System.out.println("tearDownAfterClass");
		//fileName = new ICScreation(null);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		//Code executed before each test
		System.out.println("setUp");
		//initialize the variables 
		//testNULL = new ICScreation(null);
		//fileName = new ICScreation("");
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		//Code executed after each test
		System.out.println("tearDown");
		//release any permanent resources allocated in setup
		
	}
	
	/**
	 * Run tests from a Java program and show the result on the console
	 * @return JUnit4TestAdapter
	 */
	public static JUnit4TestAdapter suite(){
		return new JUnit4TestAdapter(ICScreationTest.class);
	}
	public static void main(String[]args){
		junit.textui.TestRunner.run(suite());
	}
	
	
	/* Test for ics_creation.ICScreation creatFile()
	 * 
	 */
	@Test
	public void testCreateFileOne(){
		System.out.println("[createFile()]");
		try {
			ICScreation fileName = new ICScreation("example");
			//tester.createFile();
			assertTrue(fileName.createFile());
		} catch (IOException e) {
			fail(e.getMessage());
		}
	}
	@Test
	public void testCreateFileTwo(){
		System.out.println("[createFile()]");
		try {
			ICScreation fileName = new ICScreation("");
			//tester.createFile();
			assertFalse(fileName.createFile());
		} catch (IOException e) {
			fail(e.getMessage());
		}
	}


//	@Test(expected= IOException.class)
//	public void testCreateFile() throws IOException{
//		System.out.println("[createFile()]");
//		ICScreation fn = new ICScreation("example");
//		assertTrue(fn.createFile());
//	}
	
//	/*
//	 * Test for writeToFile()
//	 */
//	@Test
//	public void writeToFileTest(){
//		System.out.println("[writeToFileTest()]");
//		
//	}
	
//	/*
//	 * Test for icsFormat()
//	 */
//	@Test
//	public void icsFormat(){
//		System.out.println("[icsFormat()]");
//		
//	}
		
	/*
	 * Test for checkValidDateTest()
	 */
	@Test
	public void checkValidDateTestOne(){
		System.out.println("[checkValidDateTestOne()]");
		//year >= 2012
		assertFalse(ICScreation.checkValidDate("may", "4", "2010"));
	}
	/*
	 * Test for checkValidDateTest()
	 */
	@Test
	public void checkValidDateTestTwo(){
		System.out.println("[checkValidDateTestTwo()]");
		assertTrue(ICScreation.checkValidDate("may", "4", "2012"));
	}
	/*
	 * Test for checkValidDateTest()
	 */
	@Test
	public void checkValidDateTestThree(){
		System.out.println("[checkValidDateTestThree()]");
		//invalid month
		assertFalse(ICScreation.checkValidDate("Jan", "4", "2012"));
	}
	/*
	 * Test for checkValidDateTest()
	 */
	@Test
	public void checkValidDateTestFour(){
		System.out.println("[checkValidDateTestFour()]");
		//invalid date
		assertFalse(ICScreation.checkValidDate("February", "30", "2012"));
	}
	
//	/*
//	 * Test for returnDateTest()
//	 */
//	@Test
//	public void returnDateTestOne(){
//		System.out.println("[returnDateTestOne()]");
//		String expected = "20120201";
//		assertEquals(expected,ICScreation.returnDate("February", "1", "2012"));
//	}
//	
//	/*
//	 * Test for returnDateTest()
//	 */
//	@Test
//	public void returnDateTestTwo(){
//		System.out.println("[returnDateTestTwo()]");
//		String expected = "20121011";
//		//months[9] = "OCTOBER", if(n < 10) -> if(n < 9)
//		//assertEquals(result,ICScreation.returnDate("October", "11", "2012"));
//		String result = ICScreation.returnDate("October", "11", "2012");
//		assertFalse(result.equals(expected));
//	}
	
	/*
	 * Test for checkValidTimeTest()
	 */
	@Test
	public void checkValidTimeTestOne(){
		System.out.println("[checkValidTimeTestOne()]");
		assertTrue(ICScreation.checkValidTime("9:00", "am"));
	}
	
	/*
	 * Test for checkValidTimeTest()
	 */
	@Test
	public void checkValidTimeTestTwo(){
		System.out.println("[checkValidTimeTestTwo()]");
		//invalid hour
		assertFalse(ICScreation.checkValidTime("13:00", "am"));
	}
	
	/*
	 * Test for checkValidTimeTest()
	 */
	@Test
	public void checkValidTimeTestThree(){
		System.out.println("[checkValidTimeTestThree()]");
		//invalid min
		assertFalse(ICScreation.checkValidTime("9:60", "am"));
	}
	/*
	 * Test for checkValidTimeTest()
	 */
	@Test
	public void checkValidTimeTestFour(){
		System.out.println("[checkValidTimeTestFour()]");
		//invalid amPm
		assertFalse(ICScreation.checkValidTime("13:00", ""));
	}
	
//	/*
//	 * Test for returnTimeTest()
//	 */
//	@Test
//	public void returnTimeTestOne(){
//		System.out.println("[returnTimeTestOne()]");
//		String expected = "T093000";
//		assertEquals(expected, ICScreation.returnTime("9:30", "am"));
//	}
//
//	/*
//	 * Test for returnTimeTest()
//	 */
//	@Test
//	public void returnTimeTestTwo(){
//		System.out.println("[returnTimeTestTwo()]");
//		String expected = "T100300Z";
//		assertEquals(expected, ICScreation.returnTime("10:3", "pm"));
//	}
	


}
